<template>
  <div class="guide-qrcode-view">

    <!-- start 标题 -->
    <div class="guide-qrcode-title">

      <div class="guide-qrcode-content">
        <i class="iconfont icon-morenyixuan"></i>
        <span>{{ $t('common.trade.text47') }}</span>
      </div>

    </div>
    <!-- end 标题 -->

    <div class="guide-qrcode-container">
      <div class="guide-qrcode-subtitle">
        {{ $t('common.trade.text29') }}
      </div>
      <div class="guide-qrcode-service-lists">
        <div class="guide-qrcode-service-list" v-for="(item, index) in serviceList" :key="`guide_qrcode_service_list${index}`">
          <div class="guide-qrcode-service-list-icon">
            <img :src="item.icon"> 
            <!-- <i class="iconfont" :class="item.icon"></i> -->
          </div>
          <span> {{ item.text }} </span>
        </div>
      </div>
      <!-- start 电话 -->
      <div class="guide-qrcode-phone">
        {{ $t('common.base.customerServiceTelephone') }}：<span>{{ phone }}</span>
      </div>
      <!-- end 电话 -->
    </div>

    <!-- start 底部 -->
    <div class="guide-qrcode-footer">
      <base-button @event="systemIn">{{ $t('common.trade.text48') }}</base-button>
    </div>
    <!-- end 底部 -->

  </div>
</template>

<script>
import { saveGuideSetting } from '@src/api/GuideApi.js';
import { getOssUrl } from '@src/util/assets'
import { isNewVersion } from '@src/util/version'
export default {
  name: 'guide-step-four-qrcode',
  props: {
    data: {
      type: Object,
      default: () => ({})
    }
  },
  data() {
    return {
      phone: '400-882-8865',
      serviceList: [
        {
          icon: getOssUrl('/guide/guide-flow.png'),
          text: this.$t('common.trade.text30')
        },
        {
          icon: getOssUrl('/guide/guide-setting.png'),
          text: this.$t('common.trade.text31')
        },
        {
          icon: getOssUrl('/guide/guide-help.png'),
          text: this.$t('common.trade.text32')
        }
      ]
    }
  },
  computed: {
    qrCode(){
      return `/files/getQrcode?fileName=${this.data.qrcode}`;
    },
  },
  mounted () {
    // 现在新版更多行业也传 其他
    let profession = '其他'
    if(this.data.profession && this.data.profession != '更多行业') {
      profession = this.data.profession
    }
    saveGuideSetting({ profession }).then(result => {
      if( result.status != 0) {
        this.$platform.notification({
          type: 'error',
          message: result.message
        })
      }
    }).catch(err => {
      console.log(err)
    })
  },
  methods: {
    // 进入系统
    systemIn() {
      this.$emit('next', [3, { key: 'isShowUserGuide', value: true }]);
      // 这是哪个页面来着
      this.$platform.refreshTab('M_HOME');
    }
  },
}
</script>

<style lang="scss">
.guide-qrcode-view {
  height: 100%;
  text-align: center;

  .guide-qrcode-title {
    color: #333;
    font-size: 24px;

    padding: 35px 0 40px;
  }


  .guide-qrcode-content {
    display: flex;
    flex-wrap: nowrap;
    flex-flow: column;
    
    i {
      color: $color-primary-light-6;
      font-size: 60px;
    }

    span {
      line-height: 33px;
      margin-top: 20px;
    }

  }

  img {
    height: 150px;
    width: 150px;
  }

  .guide-qrcode-tip {
    color: #666;
    line-height: 20px;
    padding: 15px 0 35px;
  }

  .guide-qrcode-container {
    background: #F6FFFE;
    padding: 24px 80px;
  }
}

.guide-qrcode-subtitle {
  color: #333;
  font-size: 18px;
  line-height: 25px;

  position: relative;

  &::before,
  &::after {
    background-color:#d8d8d8;
    content: "";

    height: 1px;
    width: 240px;

    position: absolute;
    top: 50%;
    transform: translateY(-50%);
  }
  &::before {
    left: 0;
  }
  &::after {
    right: 0
  }

}

.guide-qrcode-service-lists {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;

  padding: 35px 0px;

  .guide-qrcode-service-list {
    width: 100px;
    .guide-qrcode-service-list-icon {
      img {
        width: 40px;
        height: 40px;
      }
    }
    span {
      display: inline-block;
      margin-top: 10px;
    }

  }
}

.guide-qrcode-phone {
  color: #333;

  span {
    @include fontColor();
  }

}

.guide-qrcode-footer {
  padding-top: 48px;

  .base-button {
    border-radius: 5px;

    height: 38px;
    width: 120px;
  }
}
</style>